// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Transition.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Microsoft.Robotics.Manipulation.ControllerStateMachine
{
    using System.Collections.Generic;

    /// <summary>
    /// Represents a transition in a controller state machine.
    /// </summary>
    public class Transition
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Transition"/> class.
        /// </summary>
        /// <param name="targetState">Target state of transition.</param>
        /// <param name="testOpCode">Op code of operation used to trigger transitions.</param>
        /// <param name="operands">IDs of registers holding operands for test operation.</param>
        /// <param name="operations">Operations to perform when transition triggers.</param>
        public Transition(
            State targetState,
            int testOpCode,
            RegisterID[] operands,
            ControllerOperation[] operations)
        {
            this.TargetState = targetState;
            this.TestOpCode = testOpCode;
            this.Operands = operands;
        }

        /// <summary>
        /// Gets target state of transition.
        /// </summary>
        public State TargetState { get; private set; }

        /// <summary>
        /// Gets op code of operation used to trigger transition.
        /// </summary>
        public int TestOpCode { get; private set; }

        /// <summary>
        /// Gets IDs of registers containing operands for test operation.
        /// </summary>
        public RegisterID[] Operands { get; private set; }

        /// <summary>
        /// Gets operations to perform when transition triggers.
        /// </summary>
        public ControllerOperation[] Operations { get; private set; }
    }
}
